<script setup name="card">
import CountTo from '@/components/CountTo.vue'

defineProps({
  title: String,
  tip: String,
  btns: Array,
})
</script>

<template>
  <el-card shadow="hover">
    <template #header>
      <div class="card-header">
        <span class="card-title">{{ title }}</span>
        <el-tag type="danger" effect="plain">{{ tip }}</el-tag>
      </div>
    </template>
    <el-row :gutter="10">
      <el-col :span="6" :offset="0" v-for="(item, index) in btns" :key="index">
        <el-card shadow="never" class="card-body" :body-style="{ 'padding-left': '10px', 'padding-right': '10px' }">
          <div class="card-content">
            <span class="num">
              <CountTo :value="item.value" />
            </span>
            <span class="data">{{ item.label }}</span>
          </div>
        </el-card>
      </el-col>
    </el-row>
  </el-card>
</template>

<style lang="scss" scoped>
.el-card {
  border: 0;
  .card-header,
  .card-body {
    white-space: nowrap;
    display: flex;
    justify-content: space-between;
  }
  .card-body {
    background: var(--bg-light);
    justify-content: center;
    .card-content {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      .num {
        font-size: var(--text-xl);
        margin-bottom: 4px;
      }
      .data {
        font-size: var(--xs);
        color: var(--gray500);
      }
    }
  }
}
</style>
